node {
    stage('git chekout') {
        checkout([$class                           : 'GitSCM',
                  branches                         : [[name: "master"]],
                  doGenerateSubmoduleConfigurations: false,
                  extensions                       : [],
                  gitTool                          : 'Default',
                  submoduleCfg                     : [],
                  userRemoteConfigs                : [[url: 'https://gitee.com/fastjrun/xxl-job-api.git']]
        ])
    }
    stage('package server') {
        sh 'mkdir -p xxl-job-api-base/src/main/java && mvn clean package -pl xxl-job-api-server -am -Dbdgc.skip=false'
    }
    stage('docker build') {
        sh 'mkdir -p output && rm -rf output/* ' +
                '&& cp xxl-job-api-server/target/xxl-job-api-server.jar ./output/app.jar ' +
                '&& cp Dockerfile ./output && cp entrypoint.sh ./output'
        sh 'cd output && docker build . -t fastjrun/xxl-job-api-server:2.3.0'
    }
}